import axios from 'axios';
import {CHANGE_LIST} from './constants'

const changeList = (list)=>({
  type:CHANGE_LIST,
  list
})

export const getHomeList = ()=>{
  return (dispatch)=>{
    return axios.get('https://www.easy-mock.com/mock/5ba8cc49a8066d21b71a4678/example/news')
      .then((res)=>{
        const list = res.data.data.list;
        dispatch(changeList(list))
      })
  }
}